package org.example.domain.controller;

import com.aya.export.annotation.ExcelExport;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.example.domain.entity.Domain;
import org.example.domain.service.DomainService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DomainController {
    private final DomainService domainService;

    public DomainController(DomainService domainService) {
        this.domainService = domainService;
    }

    @GetMapping("/domains/base")
    public IPage<Domain> listDomains(
            @RequestParam(defaultValue = "1") int page,
            @RequestParam(defaultValue = "10") int size) {
        return domainService.getDomainPage(page, size);
    }

    @ExcelExport(queryMethod = "listDomains")
    @GetMapping("/domains/base/export")
    public void listDomainsExport(
            @RequestParam(defaultValue = "1") int page,
            @RequestParam(defaultValue = "10") int size) {
    }
}
